﻿/*
 *   ErrorCodes.cs
 *   Copyright (c) 2011 - BitFox Software and Ricardo Federico Villafañes
 *   Contact: federvillaf@hotmail.com
 *   
 *   Licensing: This product is covered by Microsoft Reciprocal License (MS-RL)
 *              see https://bitfoxeval.codeplex.com/license
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BitFox
{
    /// <summary>
    /// Enumeration of possible error codes thrown by a BitFox component.
    /// </summary>
    public enum ErrorCode
    {
        /// <summary>
        /// Unknown error. Please, report <b>BitFox</b> about the conditions under which this error was produced.
        /// </summary>
        Unknown = 0,

        /// <summary>
        /// You requested an operation that requires an opened DBF in actually selected area.
        /// </summary>
        DBNotOpened,

        /// <summary>
        /// The indicated file is not a DBF file or it is broken.
        /// </summary>
        NotADbfTable,

        /// <summary>
        /// The file is in use by another process and cannot be opened.
        /// </summary>
        CannotOpenFile,

        /// <summary>
        /// The file is broken
        /// </summary>
        InvalidSeekOffset,

        /// <summary>
        /// Cannot write to a file.
        /// </summary>
        DiskFull,

        /// <summary>
        /// A sintax error was detected during compilation.
        /// </summary>
        SintaxError,

        /// <summary>
        /// During compilation, a valid (but unsupported) statement was found.
        /// </summary>
        UnsupportedStatement,

        /// <summary>
        /// An operation was requested through a class that holds an already closed file.
        /// </summary>
        TableIsNotOpened,

        /// <summary>
        /// The file to open has features not actually supported by BitFox's engine.
        /// </summary>
        UnsupportedFieldType,

        /// <summary>
        /// The indicated file is not found.
        /// </summary>
        FieldDoesNotExists,

        /// <summary>
        /// You requested an operation that requires a numbers field.
        /// </summary>
        FieldNotConvertibleToNumber,

        /// <summary>
        /// The record is in use by another user.
        /// </summary>
        RecordCannotBeLocked,

        /// <summary>
        /// When an index is loaded, its type cannot be determined.
        /// </summary>
        UnrecognizedIndexType,

        /// <summary>
        /// Please, report to <b>BitNet</b> the conditions under which this error was trigger.
        /// </summary>
        InternalError,

        /// <summary>
        /// The type for an index's key is too large or it is of an unsupported type (like booleans).
        /// </summary>
        InvalidIndexKey,

        /// <summary>
        /// The type of index's key is not one of the supported types.
        /// </summary>
        InvalidIndexKeyType,

        /// <summary>
        /// Your request requires than an index is opened and designed as master.
        /// </summary>
        NotMasterIndex,

        /// <summary>
        /// The indicated order is not found in loaded list of indexes.
        /// </summary>
        OrderNotFound,

        /// <summary>
        /// The filter expression don't evaluate to a boolean.
        /// </summary>
        FilterExpressionMustBeBoolean,

        /// <summary>
        /// The index is broken.
        /// </summary>
        RecordIsOutOfRange,

        /// <summary>
        /// The operation requested on a table requires that the table was open in exclusive mode
        /// </summary>
        ExclusiveUseRequired,

        /// <summary>
        /// The file cannot be modified because it was opened in a read-only way.
        /// </summary>
        ReadOnly,

        /// <summary>
        /// The combination of arguments for an IndexOn operation is invalid.
        /// </summary>
        BadIndexOnArguments,

        /// <summary>
        /// There is an error trying to optimize a filter with Rushmore. Probably, an inner exception do a bit more
        /// for explaining the issue.
        /// </summary>
        CannotOptimize,

        /// <summary>
        /// The object was not created with ProxyFactory, thus, it doesn't have a ProxyID or ProxyInterceptor
        /// </summary>
        NotCreatedWithProxyFactory = 180,

        /// <summary>
        /// The reserved properties (ProxyID and ProxyInterceptor) wasn't properly type in base class. The proper
        /// signatures for them are: <b>public abstract int ProxyID { get; }</b> or
        /// <b>public abstract IInterceptor ProxyInterceptor { get; }</b>.
        /// </summary>
        IncompatibleBaseProperty,

        /// <summary>
        /// Your expression mix types that cannot be converted to a number.
        /// </summary>
        CannotConvertToNumber = 200,

        /// <summary>
        /// An expression argument cannot be promoted to another.
        /// </summary>
        CannotPromoteValues,

        /// <summary>
        /// You requieres to compare two uncomparable objects.
        /// </summary>
        CannotCompareValues,

        /// <summary>
        /// Overflow.
        /// </summary>
        Overflow,

        /// <summary>
        /// You requested an operation that cannot be performed, due to problems in passed arguments.
        /// </summary>
        CannotDoDesiredOperation,

        /// <summary>
        /// There is an error during expression compilation.
        /// </summary>
        CompilerError,

        /// <summary>
        /// A variable cannot be found.
        /// </summary>
        VariableNotFound,

        /// <summary>
        /// A call to a function cannot be performed. See exception's message property for further information.
        /// </summary>
        CannotCallFunction,

        /// <summary>
        /// A required argument cannot be found.
        /// </summary>
        MissingOperand,

        /// <summary>
        /// An index for an array operation was not indicated.
        /// </summary>
        MissingArrayIndex,

        /// <summary>
        /// During parsing, an expected token si not found.
        /// </summary>
        MissingToken,

        /// <summary>
        /// Please, report to <b>BitFox</b> the causes under which this error appear.
        /// </summary>
        ExecutionError,

        /// <summary>
        /// You're trying to get data from a table, but the row pointer is positioned after the end of the file.
        /// </summary>
        RowPointerIsAfterEndOfFile,

        /// <summary>
        /// You're trying to get data from a table, but there aren't any row in the table.
        /// </summary>
        NoRowIsAvailable,

        /// <summary>
        /// The index is destroyed. Please, re-create it.
        /// </summary>
        RecreateIndex,

        /// <summary>
        /// The column you indicated to gather data of a table is not belonging to that table.
        /// </summary>
        TheColumnDoesNotBelongsToTable,

        /// <summary>
        /// The record is in use by another user.
        /// </summary>
        CannotLockRecord,

        /// <summary>
        /// The FoxTable attribute must be used for decorating an entity that must be used for describing a table.
        /// </summary>
        MissingFoxTableAttribute,

        /// <summary>
        /// No fields have been defined to be processed
        /// </summary>
        MissingFieldsToProcess,

        /// <summary>
        /// One of indicated field is not part of the table under examination
        /// </summary>
        FieldNotFound,

        /// <summary>
        /// Searching an entity indicates than the requested entity is not found
        /// </summary>
        KeyNotFound,
    }
}
